<script type="text/javascript">
function SelectAll(checkboxall)
{
	$(".updatecheckbox").attr("checked", checkboxall.checked);
}
</script>

<div class="deal">
<div class="deal_content_top"></div>
<div class="deal_content">
<h3>Category</h3>
<table class="table-style" style="width: 100%;" cellpadding="5px"
	cellspacing="0">
	<tbody>
		<tr class="table-title">
			<td><input type="checkbox" onchange="SelectAll(this);" /></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=i.item_id&order=<?php echo ($this->by != "i.item_id" || $this->order == "desc") ? "asc" : "desc"; ?>">ID</a></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=o.status&order=<?php echo ($this->by != "o.status" || $this->order == "desc") ? "asc" : "desc"; ?>">Đơn hàng</a></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=i.quantity&order=<?php echo ($this->by != "i.quantity" || $this->order == "desc") ? "asc" : "desc"; ?>">Số lượng</a></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=u.fullname&order=<?php echo ($this->by != "u.fullname" || $this->order == "desc") ? "asc" : "desc"; ?>">Người mua</a></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=i.barcode&order=<?php echo ($this->by != "i.barcode" || $this->order == "desc") ? "asc" : "desc"; ?>">Barcode</a></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/barcode/index/deal_id/" . $this->deal_id) ?>?by=i.barcode_status&order=<?php echo ($this->by != "i.barcode_status" || $this->order == "desc") ? "asc" : "desc"; ?>">Trạng thái</a></td>
			<td>&nbsp;</td>
		</tr>
		<?php
		if (count($this->paginator) == 0) {
			echo "<tr><td colspan='3' align='center'>No order</td></tr>";
		} else {
			?>
			<form action="" method="post">
			<?php $i = 0 ?>
			<?php foreach ($this->paginator as $item): ?>
		<tr class="<?php echo $i % 2 == 0 ? 'even' : 'odd' ?>">
			<td><input class="updatecheckbox" type="checkbox" name="checkbox[]" value="<?php echo $item->item_id ?>" /></td>
			<td><?php echo $item->item_id ?></td>
			<td><?php echo $this->order_status[$item->status] ?></td>
			<td><?php echo $item->quantity ?></td>
			<td><?php echo $item->fullname ?></td>
			<td><?php echo $item->barcode ?></td>
			<td><?php echo $this->barcode_status[$item->barcode_status] ?></td>
			<td><a href="<?php echo $this->baseUrl("index.php/admin_cms/order/edit/id/" . $item->order_id) ?>">Chi tiết</a></td>
		</tr>
		<?php $i++ ?>
		<?php endforeach ?>
		<tr>
			<td colspan="5">
				Trạng thái
				&nbsp;&nbsp;
				<select name="status">
					<?php
					for($i = 0; $i < count($this->barcode_status); $i++)
					{
						echo "<option value='$i'>{$this->barcode_status[$i]}</option>";
					}
					?>
				</select>
				&nbsp;&nbsp;
				<input type="submit" value="Cập nhật" />
			</td>
		</tr>
		</form>
		<?php } ?>
	</tbody>
</table>
		
<?php echo $this->paginator; ?>
</div>

<div class="deal_content_bottom"></div>
</div>
